package net.jsoft.platform.security.entity.user;

import java.beans.Transient;
import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

//角色表  
@Entity
@Table(name = "t_security_role")
public class SysRole implements Serializable, Comparable<SysRole>
{
    /**
     * 
     */
    private static final long serialVersionUID = -6875397435111636754L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", length = 10)
    private long id;

    @Column(name = "name", length = 100)
    private String name;//角色名称  

    //    @ManyToMany(mappedBy = "sysRoles")
    //    private Set<SysUser> users;

    private String checked;

    //    public Set<SysUser> getUsers()
    //    {
    //        return users;
    //    }
    //
    //    public void setUsers(Set<SysUser> users)
    //    {
    //        this.users = users;
    //    }

    @Transient
    public String getChecked()
    {
        return checked;
    }

    public void setChecked(String checked)
    {
        this.checked = checked;
    }

    public long getId()
    {
        return id;
    }

    public void setId(long id)
    {
        this.id = id;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    @Override
    public int compareTo(SysRole o)
    {
        if (this == o)
        {
            return 0;
        }
        else if (o != null && o instanceof SysRole)
        {
            SysRole u = (SysRole) o;
            if (id <= u.id)
            {
                return -1;
            }
            else
            {
                return 1;
            }
        }
        else
        {
            return -1;
        }
    }

}